package com.orm.analysis.controller;

import com.orm.analysis.service.CustomerService;
import com.orm.analysis.util.GlobalConst;
import org.apache.log4j.Logger;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Created with IntelliJ IDEA.
 * User: saman
 * Date: 10/10/13
 * Time: 11:08 AM
 * To change this template use File | Settings | File Templates.
 */
public class CustomerCtlr {


    private static Logger logger = Logger.getLogger(CustomerCtlr.class);

        public static void main(String[] args) {

    //        configure logging   and start process execution
            try {
                String configFileName = "none";
                configFileName = System.getProperty(GlobalConst.LOG_CONFIGURATION, configFileName);
                org.apache.log4j.PropertyConfigurator.configure(configFileName);
                ApplicationContext springContext = new ClassPathXmlApplicationContext(GlobalConst.PATHS);
                CustomerService customerService  = (CustomerService) springContext.getBean("customerService");
                customerService.executeImproter();
            } catch (Exception e) {
                logger.error("Application Error", e);
                throw new RuntimeException("Error in process, nothing saved to database",e);
            }



        }

}
